package com.clqteam.serviceimpl;

import java.util.List;

import com.clqteam.dao.AccountDao;
import com.clqteam.daoimpl.AccountDaoImpl;
import com.clqteam.model.Account;
import com.clqteam.service.AccountService;

import net.sf.json.JSONObject;

public class AccountServiceImpl implements AccountService{

	AccountDao aDao = new AccountDaoImpl();
	
	@Override
	public JSONObject findAccount(int page, int rows) {
		JSONObject j = new JSONObject();
		int total = aDao.getCountAccount();
		List<Account> accounts = aDao.getAccount(page, rows);
		j.put("total", total);
		j.put("rows", accounts);
		return j;
	}

	@Override
	public JSONObject findAccountByKeyAndDT(String key, String begindt, String enddt, int page, int rows) {
		JSONObject j = new JSONObject();
		int total = aDao.getCountAccountByKeyAndDT(key, begindt, enddt);
		List<Account> accounts = aDao.getAccountByKeyAndDT(key, begindt, enddt, page, rows);
		j.put("total", total);
		j.put("rows", accounts);
		return j;
	}

}
